﻿using Localization.Resources.AbpUi;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using PermissionManagement.Localization;
using Microsoft.Extensions.DependencyInjection;
using Xms.Abp.AspNetCore.Mvc;
using Xms.Abp.Modularity;

namespace PermissionManagement.HttpApi;

[DependsOn(
    typeof(PermissionManagementApplicationContractsModule),
    typeof(XmsAbpAspNetCoreMvcModule)
    )]
public class PermissionManagementHttpApiModule : XmsModule
{
    public override void PreConfigureServices(ServiceConfigurationContext context)
    {
        PreConfigure<IMvcBuilder>(mvcBuilder =>
        {
            mvcBuilder.AddApplicationPartIfNotExists(typeof(PermissionManagementHttpApiModule).Assembly);
        });
    }

    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        Configure<AbpLocalizationOptions>(options =>
        {
            options.Resources
                .Get<PermissionManagementResource>()
                .AddBaseTypes(
                    typeof(AbpUiResource)
                );
        });
    }
}
